<template>
    <div>
<h1>会员信息注册</h1>
<table class="table table-bordered" border="1">
    <tr>
        <td>编号</td>
        <td><input type="text" v-model="tj.guid"></td>
    </tr>

    <tr>
        <td>名字</td>
        <td><input type="text" v-model="tj.name"></td>
    </tr>

    <tr>
        <td>性别</td>
        <td><input type="radio" :value="false" v-model="tj.xb">男
            <input type="radio":value="true" v-model="tj.xb">女</td>
    </tr>

    <tr>
        <td>号码</td>
        <td><input type="text" v-model="tj.hoam"></td>
    </tr>

    <tr>
        <td>身份证</td>
        <td><input type="text" v-model="tj.sfz"></td>
    </tr>

    <tr>
        <td>级别</td>
        <td><select v-model="tj.jb">
            <option value="0">请选择</option>
            <option v-for="item in lx" :value="item.id">{{item.yname}}</option>
        </select></td>
    </tr>

    <tr>
        <td>状态</td>
        <td><input type="radio" :value="false" v-model="tj.zt">良好
            <input type="radio" :value="true" v-model="tj.zt">冻结</td>
    </tr>

    <tr>
        <td>积分</td>
        <td><input type="text" v-model="tj.jf"></td>
    </tr>

    <tr>
        <td>价钱</td>
        <td><input type="text" v-model="tj.yue"></td>
    </tr>

    <tr>
        <td>时间</td>
        <td><input type="date" v-model="tj.date"></td>
    </tr>

    <tr>
        <td></td>
        <td><input type="button" value="注册" @click="yzadd"></td>
    </tr>
</table>
    </div>
</template>

<script setup lang="ts">
import { ref, onMounted} from "vue";
import axios from "axios";
import { post } from "node_modules/axios/index.cjs";



const lx=ref([{
     id:0,
    yname:""
}])

onMounted(()=>{

    yz();

})


const tj=ref({
    id:0,
    guid: "",
    name: "",
    xb: false,
    hoam: "",
    sfz: "",
    jb: 0,
    zt: false,
    jf: 0,
    yue: 0,
    date: "",
    dydjid:0
})

const yz =()=>{

axios.get('https://localhost:7268/api/hy/hyjblist')

.then(res=>{


lx.value=res.data;
    
})


}


const yzadd=()=>{

axios.post('https://localhost:7268/api/hy/xxaddlist',tj.value)

.then(res=>{
    console.log(res.data);
    if(res.data>0)
{

alert('注册成功');
}
else{
    alert('注册失败');
}


})
}





</script>

<style scoped>

</style>